home *** CD-ROM | disk | FTP | other *** search
- /* e x i t
- *
- * Exit with stdio wrap up. A scan is made of the exit handler list.
- * All non-null pointers will be used to call the named functions.
- * Finally the stdio exit handler, _ioflush(), is called, followed by an
- * _exit().
- *
- * Patchlevel 1.1
- *
- * Edit History:
- * 06-Sep-1989 Corrected prototypes. Correct exit handler table
- * initialisation. Lint control.
- * 05-Sep-1989 Created.
- */
-
- #include "stdiolib.h"
-
- /*LINTLIBRARY*/
-
- #define MAX_HANDLERS 15 /* maximum number of handlers */
-
- void exit P((int)); /* exit coming up */
-
- /* Exit handler list */
- static void (*_exit_list[MAX_HANDLERS+1]) P((void)) = {_ioflush};
-
- /* Exit handler list pointer */
- void (**_exit_hp) P((void)) = &_exit_list[MAX_HANDLERS];
-
- void exit(status)
-
- int status; /* exit status */
-
- {
- int _exit P((int)); /* exit */
-
- for ( ; _exit_hp < &_exit_list[MAX_HANDLERS]; )
- (*++_exit_hp)();
- _ioflush();
- (void) _exit(status);
- }
-